<?php

class Plugin_Checkauth extends Zend_Controller_Plugin_Abstract{
	public function preDispatch(Zend_Controller_Request_Abstract $request)
	{
		$controllerName = $request->getControllerName();
		$flagAdmin = false;
		if ($request->getModuleName() == 'admin') {
			$flagAdmin = true;
		}
		
		$session = new Zend_Session_Namespace('login');
		
		
		if($flagAdmin & !isset($session->login)){
		
			$request->setModuleName('admin');
			$request->setControllerName('index');
			$request->setActionName('login');
		
		}
	}
	
}

?>